#九九乘法表
for i in range(1,10): #循环9次,从1开始循环
    for j in range(1,i+1): #叫j从1开始循环,循环次数是i次,所以用i+1表示
        print("{}*{}={:<3}".format(j,i,i*j),end="");
    print(" ");

print("");
for i in range(9,0,-1):     #递减循环,每次减一
    for j in range(1,i+1):
        print("{}*{}={:<3}".format(j,i,i*j),end=""); #格式化输出
    print(" ");

print(" ");
j=1     #初始化j=1
while j<=9:     #循环9次.从1开始循环到9
    i=1
    while i<=j:     #嵌套循环,循环每列的乘法列表
        print("{}*{}={:<3}".format(j, i, i * j),end="");
        i+=1;
    j+=1;
    print("");

print(" ");
j=9;    #设置初始值为9
while j>=1:
    i=1
    while i<=j: #嵌套循环 循环j次
        print("{}*{}={:<3}".format(j, i, i * j),end="");#打印j乘法从1~j
        i+=1;
    j-=1;
    print("");

#银行存取系统简易版
#存储用户基本信息
userList = [{"loginId":"001","pwd":"123456","userName":"张三","money":10000},{"loginId":"002","pwd":"123456","userName":"李四","money":20000},
             {"loginId":"003","pwd":"123456","userName":"王五","money":30000},{"loginId":"004","pwd":"123456","userName":"赵六","money":40000},]
def welcome():
    key = input("这里是广告,要进入银行系统请输入Y:")
    if key.lower()=='y':
        bankService()
    else:
        print("这里是广告!")
        welcome()
def bankService():
    while True:
        i=1
        print("="*14,"欢迎进入银行存储系统","="*14);
        login = input("输入用户名:");#接收登录名
        pwd = input("输入密码:");#接收密码
        for person in userList:
            if person["loginId"]==login and person["pwd"]==pwd:#循环遍历是否有匹配的用户名和密码,这个方法不好,
                bus_type = input("请选择业务类型1:取钱,2:存钱,3:查询余额,4:退出系统:");
                bus_type = int(bus_type);#将接收的数字转换为int类型,方便后面书写
                if bus_type == 1:           #判断业务
                    get_money = input("请输入要取的钱:")
                    if int(person["money"]) < int(get_money):
                        print("您的存款不足.");
                        break
                    else:
                        print("请取走您的现金!")
                        print("您的银行存款余额是:"+str(person["money"]-int(get_money)));
                        person["money"] = person["money"]-int(get_money) ;  #保存余额
                        break
                elif bus_type == 2:         #存钱
                    in_money = input("请输入要存入钱的金额:")
                    in_money = int(in_money)
                    person["money"] = person["money"]+in_money
                    print("您的存款为:"+str(person["money"]))
                    break
                elif bus_type == 3:
                    print("您的余额是:"+str(person["money"]))
                elif bus_type == 4:
                    print("已退出系统")
                    welcome()

            # else:
            #     print("输入的用户名密码错误!请重试!")

if __name__ == '__main__':
    welcome()